package mysql

import "gorm.io/gorm"

type Book struct {
	gorm.Model
	Title  string `gorm:"type:varchar(20);not null;comment:标题"`
	UserId int64  `gorm:"type:int;not null;comment:用户Id"`
	Image  string `gorm:"type:varchar(500);not null;comment:封面图"`
	Info   string `gorm:"type:varchar(2000);not null;comment:简介"`
	//ClassId      int64  `gorm:"type:int;not null;comment:分类Id"`
	//LabelId      int64  `gorm:"type:int;not null;comment:标签Id"`
	//BrowseNumber int64  `gorm:"type:int(11);not null;comment:浏览量"`
}

type Class struct {
	gorm.Model
	Title string `gorm:"type:varchar(20);not null;comment:分类名称"`
}

// 标签属于自己给自己的分类
type Label struct {
	gorm.Model
	Title  string `gorm:"type:varchar(20);not null;comment:标签名称"`
	UserId int64  `gorm:"type:int;not null;comment:用户Id"`
}

type BookData struct {
	Book
	UserName   string
	Avatar     string
	ClassTitle string
	LabelTitle string
	Info       string
}

type BookShelf struct {
	gorm.Model
	UserId int64 `gorm:"type:int(11);not null;comment:'用户ID'"`
	BookId int64 `gorm:"type:int(11);not null;comment:'图书ID'"`
}

type BookShelfData struct {
	BookId    int64
	Image     string
	BookTitle string
}

type BookRate struct {
	gorm.Model
	UserId  int64  `gorm:"type:int(11);not null;comment:'用户ID'"`
	BookId  int64  `gorm:"type:int(11);not null;comment:'图书ID'"`
	Content string `gorm:"type:varchar(500);not null;comment:评论内容"`
}

type BookRateData struct {
	BookRate
	Avatar   string
	UserName string
}

type BookList struct {
	Book
	Username string
}
